import {baseUrl} from "@/config/env";
import startSearchModel from "../../../config/startSearchModel";
import startDictionary from "@/config/startDictionary";

export default () => {
    return {
        submitText: '保存',
        size: 'default',
        labelWidth: 100,
        index: true,
        page: true,
        align: "center",
        menuType: 'menu',
        menuAlign: 'center',
        menuPosition: "right",
        editBtn: true,
        addBtn: true,
        searchIndex: 2,
        searchMenuSpan: 6,
        searchIcon: true,
        permissionBtn: {
            addBtn: 'start:formEngine:form:add',
            editBtn: 'start:formEngine:form:edit',
            viewBtn: 'start:formEngine:form:info',
            delBtn: 'start:formEngine:form:delete',
        },
        column: [
            {
                label: 'id',
                span: 24,
                prop: 'id',
                display: false,
                hide: true,
            },
            {
                label: '类别',
                span: 24,
                prop: 'formCategory',
                type: 'tree',
                editDetail: true,
                dicUrl: baseUrl + "/start/sysDictionaryItem/listByDictionaryCode",
                dicQuery: {
                    dictCode: startDictionary.cloudFormCategory
                },
                props: {
                    label: 'dictName',
                    value: 'dictVal',
                },
                dicMethod: "get",
                rules: [{
                    required: true,
                    message: "请选择类别",
                    trigger: "blur"
                }],
            },
            {
                label: '名称',
                span: 24,
                prop: 'formName',
                searchModel: startSearchModel.LIKE_RIGHT,
                search: true,
                rules: [{
                    required: true,
                    message: "请输入名称",
                    trigger: "blur"
                }]
            },
            {
                label: '数据表名',
                span: 24,
                prop: 'tableName',
                searchModel: startSearchModel.LIKE_RIGHT,
                search: true,
                rules: [{
                    required: true,
                    message: "请输入数据表名",
                    trigger: "blur"
                }],
                editDetail: true,
            },
            {
                label: '存储器',
                span: 24,
                prop: 'dataStorageType',
                type: 'select',
                editDetail: true,
                defaultIndex: 0,
                addDisabled: false,
                search: true,
                searchSpan: 6,
                dicUrl: `${baseUrl}/start/formEngine/form/getAllStorage`,
                dicMethod: "get",
                rules: [{
                    required: true,
                    message: "请选择数据存储器",
                    trigger: "blur"
                }],

            },
            {
                label: '版本',
                span: 24,
                prop: 'tableVersion',
                type: 'number',
                value: 0,
                editDisplay: false,
                addDisplay: false,
            },
            {
                label: '已发布版本',
                span: 24,
                prop: 'tablePreVersion',
                type: 'number',
                editDisplay: false,
                addDisplay: false,
            },
        ]
    }
}
